﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// NotReviewedButNeeded
#pragma once
#include <cstdint>
#include <string>

namespace gcmp
{
    /// \brief 子事务状态
    enum class SubTransactionStatus : int32_t
    {
        NotStarted = 0, /// < 未启动。
        Started,        /// < 启动了，但未提交或者回滚。
        RolledBacked,   /// < 回滚了。
        Committed,      /// < 提交了。
    };

    /// \brief 子事务结果
    struct SubTransactionResult
    {
        bool                    Result;
        SubTransactionStatus    Status;
        std::wstring            Message;

        SubTransactionResult() : Result(false), Status(SubTransactionStatus::NotStarted) {}

        SubTransactionResult(bool result, SubTransactionStatus status, const std::wstring& message)
            : Result(result), Status(status), Message(message) {}
    };
}
